package com.spzx.user.api;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.user.api.domain.UserAddress;
import com.spzx.user.api.factory.RemoteUserAddressFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * ClassName: RemoteUserAddressService
 * Package: com.spzx.user.api
 * Description:
 * 服务降级处理
 *
 * @Author 咚咚小圆帽
 * @Create 2025/3/29 15:20
 * @Version 1.0
 */
@FeignClient(
        contextId = "remoteUserAddressService",
        value = ServiceNameConstants.USER_SERVICE,
        fallbackFactory = RemoteUserAddressFallbackFactory.class
)
public interface RemoteUserAddressService {

    @GetMapping(value = "/userAddress/getUserAddress/{id}")
    R<UserAddress> getUserAddress(
            @PathVariable("id") Long id,
            @RequestHeader(SecurityConstants.FROM_SOURCE) String source
    );
}
